//#define _CRT_SECURE_NO_WARNINGS 1
//给出年分m和一年中的第n天，算出第n天是几月几号。
//输入包括两个整数y(1 <= y <= 3000)，n(1 <= n <= 366)。
//输入：
//2000 3
//2000 31
//2000 40
//2000 60
//2000 61
//2001 60 
//复制
//输出：
//2000 - 01 - 03
//2000 - 01 - 31
//2000 - 02 - 09
//2000 - 02 - 29
//2000 - 03 - 01
//2001 - 03 - 01
#include <iostream> 
using namespace std;
int GetMonthDay(int year, int month)
{
    if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12)
    {
        return 31;
    }
    else if (month == 4 || month == 6 || month == 9 || month == 11)
    {
        return 30;
    }
    else if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0))
    {
        return 29;
    }
    else
    {
        return 28;
    }

}
int main()
{
    int m, n;
    cin >> m >> n;
    int day = n;
    int year = m;
    int month = 1;
    while (day > GetMonthDay(year, month))
    {
        day = day - GetMonthDay(year, month);
        month++;
        if (month == 13)
        {
            month = 1;
            year++;
        }
    }
    printf("%d-%02d-%02d\n", year, month, day);
}